<?php

/**
 * @time 16:41:12 2017-9-3
 * @author huangbin(binhuang4@iflytek.com)
 */

namespace App\Common;

use UsersModel;

trait loginTrait {
    
    public function loginAction(){
        $name = $_POST['name'];
        $password = $_POST['password'];
        $checkUser = UsersModel::where('name',$name)->where('password',  md5($password))->exists();
        if($checkUser){
            $data = ['flag'=>true,'msg'=>'登陆成功'];
            Util::printJson(Util::printJson($data));
        }else{
            $data = ['flag'=>false,'msg'=>'用户名or密码错误','data'=>[]];
            Util::printJson(Util::printJson($data));
        }
    }
}
